644dc7d892ad00cd88a4d5ada5cdbdeb47083189,portal-impl/src/com/liferay/portlet/messageboards/service/impl/MBMessageLocalServiceImpl.java,MBMessageLocalServiceImpl,deleteMessage,#MBMessage#,632
Before Change
MBCategory category = mbCategoryPersistence.findByPrimaryKey(
message.getCategoryId());
category.setThreadCount(category.getThreadCount() - 1);
category.setMessageCount(category.getMessageCount() - 1);
mbCategoryPersistence.update(category, false);
}
else if (count > 1) {
MBThread thread = mbThreadPersistence.findByPrimaryKey(
After Change
MBCategory systemCategory = mbCategoryLocalService.getSystemCategory();
boolean isSystemCategory =
(systemCategory.getCategoryId() == message.getCategoryId());
if (count == 1) {
// Attachments
long companyId = message.getCompanyId();
String portletId = CompanyConstants.SYSTEM_STRING;
long repositoryId = CompanyConstants.SYSTEM;
String dirName = message.getThreadAttachmentsDir();
try {
dlService.deleteDirectory(
companyId, portletId, repositoryId, dirName);
}
catch (NoSuchDirectoryException nsde) {
if (_log.isDebugEnabled()) {
_log.debug(nsde.getMessage());
}
}
// Subscriptions
subscriptionLocalService.deleteSubscriptions(
message.getCompanyId(), MBThread.class.getName(),
message.getThreadId());
// Thread
mbThreadPersistence.remove(message.getThreadId());
// Category
if (!isSystemCategory) {
MBCategory category = mbCategoryPersistence.findByPrimaryKey(
message.getCategoryId());
category.setThreadCount(category.getThreadCount() - 1);
category.setMessageCount(category.getMessageCount() - 1);
mbCategoryPersistence.update(category, false);
}
}
else if (count > 1) {